//package com.yycx.app.boot.handler.app;
//
//import com.yycx.common.base.entity.EntityMap;
//import com.yycx.common.base.utils.FlymeUtils;
//import com.yycx.common.enums.ColleconEnum;
//import com.yycx.common.enums.OnLineEnum;
//import com.yycx.common.mybatis.interceptor.PageInterceptor;
//import com.yycx.common.mybatis.model.PageParams;
//import com.yycx.common.mybatis.query.CriteriaQuery;
//import com.yycx.module.product.client.entity.ProdProduct;
//import com.yycx.module.product.client.entity.ProdShop;
//import com.yycx.module.product.provider.service.ProdShopService;
//import com.yycx.module.system.provider.service.SysColleconService;
//import lombok.extern.log4j.Log4j2;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//
///**
// * 商家店铺产品列表
// *
// * @author Administrator
// */
//@Component("shopProductListHandler")
//@Log4j2
//public class ShopProductListHandler implements PageInterceptor<ProdShop> {
//    @Autowired
//    private SysColleconService colleconService;
//
//    @Autowired
//    private ProdShopService shopService;
//
//
//    @Override
//    public void prepare(CriteriaQuery cq, PageParams pageParams, EntityMap params) {
//        String shopId = params.get("shopId");
//        cq.eq(ProdProduct.class, "shopId", shopId);
//        cq.eq(ProdProduct.class, "onLineState", OnLineEnum.ON.getCode());
//    }
//
//    @Override
//    public void complete(CriteriaQuery<ProdShop> cq, List<EntityMap> result, EntityMap extra) {
//        Long shopId = cq.getRequestMap().getLong("shopId");
//        if (FlymeUtils.isNotEmpty(shopId)) {
//            ProdShop shop = shopService.getById(shopId);
//            if (FlymeUtils.isNotEmpty(shop)) {
//                extra.put("shopLogo", shop.getShopLogo());
//                extra.put("shopId", shop.getShopId());
//                extra.put("shopName", shop.getShopName());
//                //店铺收藏标记
//                long shopScTag = colleconService.countCollecon(shopId, ColleconEnum.SC, ProdShop.class);
//                extra.put("shopScTag", shopScTag);
//                //店铺收藏总数
//                long shopScCount = colleconService.countAllCollecon(shopId, ColleconEnum.SC, ProdShop.class);
//                extra.put("shopScCount", shopScCount);
//                //店铺评分
//                extra.put("shopScore", shop.getShopScore());
//            }
//        }
//
//    }
//}
